package com.example.demo.service;
import com.example.demo.dao.PublicareaDao;
import com.example.demo.entity.PublicAreaEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class PublicareaService {

   @Autowired
   private PublicareaDao publicareaDao;
    /**
     * 通过ID查询单条数据
     */
    public PublicAreaEntity queryPublicareaById(Integer paid){
        return publicareaDao.queryPublicareaById(paid);
    }

    /**
     * 通过实体作为筛选条件查询
     */
    public List<PublicAreaEntity> queryPublicareaAll(){
        return publicareaDao.queryPublicareaAll();
    }

    /**
     * 新增数据
     */
    public int insertPublicarea(PublicAreaEntity publicarea){
      return   publicareaDao.insertPublicarea(publicarea);
    }

    /**
     * 修改数据
     */
    public int updatePublicarea(PublicAreaEntity publicarea){
       return publicareaDao.updatePublicarea(publicarea);
    }

    /**
     * 通过主键删除数据
     */
    public int deletePublicareaById(Integer paid){
       return publicareaDao.deletePublicareaById(paid);
    }

    /*
    * 通过bid查公共区域
    * */
    public List<PublicAreaEntity> queryPublicareaByBid(int bid) {
        return publicareaDao.queryPublicareaByBid(bid);
    }

    /*
     * 通过paname查公共区域
     * */
    public PublicAreaEntity queryPublicareaByPaname(String paname) {
        return publicareaDao.queryPublicareaByPaname(paname);
    }
}